Images and textures best practices
The required memory bandwidth that rendering of large textures and images use can slow down your application. Use these tips to improve the performance of your application by creating and using optimal images and textures:
- The easiest way to optimize the performance of your application is to reduce the amount of detail in your images by using smaller data sizes. See Adjusting the data size.
- Kanzi supports Adaptive Scalable Texture Compression (ASTC), AMD Texture Compression (ATC), Ericsson Texture Compression (ETC), PNG compression, and PowerVR Texture Compression (PVRTC) for compressing images used in textures. See Compressing textures.
- When users run your Kanzi application in an environment with a multi-core processor, Kanzi automatically uses multiple CPU cores to load the GPU resources in the kzb files to RAM. Kanzi enables you to configure how many cores you want your application to use. See Loading resources in parallel.
- Use mipmaps to create a set of downscaled sublevels from a large texture. Mipmaps increase the GPU memory use by one third, but improve the performance when the full texture does not have to be sampled. Use mipmaps to improve the performance whenever you scale a textured node. See Using mipmaps.
- Apply texture filtering to increase either quality or performance. This method can be very effective if you are familiar with the application behavior in advance. See Filtering textures.
- Use a tile atlas to improve application loading times and framerate by decreasing the number of image files that an application must load and texture switches during application runtime. See Using a tile atlas.
- OpenGL ES 2 specification does not require filtering or mipmaps for textures whose size is not power-of-two. For Kanzi to correctly render your textures, make sure that:
- Your target device supports GL_OES_texture_npot extension.
or- Size of the textures is power-of-two.
or- Textures have Mipmap Mode property set to Base and Wrap Mode property set to Clamp.
or- In > enable the Round up Image Dimensions to Nearest Power of Two property.
- Make sure that all textures have the Mipmap Mode property set to at least Nearest. Use the Mipmap Mode value Base only very small textures (for example, 4 by 4 pixels and smaller).
- Make the textures which contain only flat color no larger than 4 by 4 pixels and set the Texture Settings properties:
- Minification Filter to Nearest
- Magnification Filter to Nearest
- Mipmap Mode to Base
- When you use a Text Block Kanzi creates a glyph cache texture for every font and font size combination. You can set the height and width of glyph cache textures to adjust the size of the glyph cache texture either when it gets full, or to optimize the performance of your Kanzi application. See Glyph cache texture size.
- When your Kanzi application uses a PNG image which contains invalid ICC profile, Kanzi prints a warning to the log at application runtime. To remove the ICC profile from all PNG images, in the > enable the Remove ICC Profile From PNG Images property.
When you enable this property Kanzi removes the ICC profile from PNG images in your project during the kzb file export.
See also
Adjusting the data size
Loading resources in parallel
Using mipmaps
Using a tile atlas
Compressing textures
Filtering textures
Troubleshooting the performance of your application
Best practices
Textures
Open topic with navigation